package Object_3;

import Object_2.Student_2;

public class Student implements Cloneable{
    private String name;
    private int ID;
    private double score;
    private Money money = new Money();

    public Student(String name, int ID, double score) {
        this.name = name;
        this.ID = ID;
        this.score = score;
    }

    public int getID() {
        return ID;
    }

    public void setID(int ID) {
        this.ID = ID;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    @Override
    public Student clone() throws CloneNotSupportedException {
        Student s = (Student) super.clone();
        s.money = s.money.clone();
        return s;
    }

    public static void main(String[] args) throws CloneNotSupportedException {
        Student s1 = new Student("张三",1,80.99);
        Student s2 = s1.clone();
//        System.out.println(s1 == s2);
//        s2.setScore(100);
//        System.out.println(s2.getID());
//        System.out.println(s1.getScore());
//        System.out.println(s2.getScore());
        s2.money.setAcount(2000);
        s2.ID = 2;
        System.out.println(s1.getID());
        System.out.println(s2.getID());
        System.out.println(s1.money.getAcount());
        System.out.println(s2.money.getAcount());
        System.out.println(s1.money == s2.money);

    }
}
